package com.ruoyi.neusoft.controller;

import java.util.List;

import com.ruoyi.neusoft.domain.FileUpVo;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.neusoft.domain.AiIdentifyModelCheckT;
import com.ruoyi.neusoft.service.IAiIdentifyModelCheckTService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 智能AI模型校验信息Controller
 * 
 * @author ruoyi
 * @date 2024-04-17
 */

@Controller
@CrossOrigin
@RequestMapping("/AI/checkService")
public class AiIdentifyModelCheckTController extends BaseController
{
    private String prefix = "AI/checkService";

    @Autowired
    private IAiIdentifyModelCheckTService aiIdentifyModelCheckTService;

    @RequiresPermissions("AI:checkService:view")
    @GetMapping()
    public String checkService()
    {
        return prefix + "/checkService";
    }

    @CrossOrigin
    @PostMapping("/upload")
    public String upload(FileUpVo fileUpVo){
        return
   aiIdentifyModelCheckTService.upload(fileUpVo);
    }


    /**
     * 查询智能AI模型校验信息列表
     */
    @RequiresPermissions("AI:checkService:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(AiIdentifyModelCheckT aiIdentifyModelCheckT)
    {
        startPage();
        List<AiIdentifyModelCheckT> list = aiIdentifyModelCheckTService.selectAiIdentifyModelCheckTList(aiIdentifyModelCheckT);
        return getDataTable(list);
    }

    /**
     * 导出智能AI模型校验信息列表
     */
    @RequiresPermissions("AI:checkService:export")
    @Log(title = "智能AI模型校验信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(AiIdentifyModelCheckT aiIdentifyModelCheckT)
    {
        List<AiIdentifyModelCheckT> list = aiIdentifyModelCheckTService.selectAiIdentifyModelCheckTList(aiIdentifyModelCheckT);
        ExcelUtil<AiIdentifyModelCheckT> util = new ExcelUtil<AiIdentifyModelCheckT>(AiIdentifyModelCheckT.class);
        return util.exportExcel(list, "智能AI模型校验信息数据");
    }

    /**
     * 新增智能AI模型校验信息
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存智能AI模型校验信息
     */
    @RequiresPermissions("AI:checkService:add")
    @Log(title = "智能AI模型校验信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(AiIdentifyModelCheckT aiIdentifyModelCheckT)
    {
        return toAjax(aiIdentifyModelCheckTService.insertAiIdentifyModelCheckT(aiIdentifyModelCheckT));
    }

    /**
     * 修改智能AI模型校验信息
     */
    @RequiresPermissions("AI:checkService:edit")
    @GetMapping("/edit/{checkId}")
    public String edit(@PathVariable("checkId") Long checkId, ModelMap mmap)
    {
        AiIdentifyModelCheckT aiIdentifyModelCheckT = aiIdentifyModelCheckTService.selectAiIdentifyModelCheckTByCheckId(checkId);
        mmap.put("aiIdentifyModelCheckT", aiIdentifyModelCheckT);
        return prefix + "/edit";
    }

    /**
     * 修改保存智能AI模型校验信息
     */
    @RequiresPermissions("AI:checkService:edit")
    @Log(title = "智能AI模型校验信息", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(AiIdentifyModelCheckT aiIdentifyModelCheckT)
    {
        return toAjax(aiIdentifyModelCheckTService.updateAiIdentifyModelCheckT(aiIdentifyModelCheckT));
    }

    /**
     * 删除智能AI模型校验信息
     */
    @RequiresPermissions("AI:checkService:remove")
    @Log(title = "智能AI模型校验信息", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(aiIdentifyModelCheckTService.deleteAiIdentifyModelCheckTByCheckIds(ids));
    }
}
